package com.gsit.job.services;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.gsit.job.domain.SearchCriteria;
import com.gsit.job.domain.SearchStatus;
import com.gsit.job.domain.SearchType;

@Component
public class LoadSearchCriteria {
	
	@Autowired
	private SearchCriteriaService criteriaService;
	
	private final String RESUME_SEARCH_PATH ="http://recruiter.monsterindia.com/v2/resumedatabase/resume_search.html";
	
	public List<SearchCriteria> createSearchCriterias() {
		
		List<SearchCriteria> criterias = new ArrayList<SearchCriteria>();
		
		/*criterias.add(createSearchCriteria("0",SearchType.EXEP_WOMEN,1 ,500,RESUME_SEARCH_PATH));
		criterias.add(createSearchCriteria("1",SearchType.EXEP_WOMEN,2 ,500,RESUME_SEARCH_PATH));
		criterias.add(createSearchCriteria("2",SearchType.EXEP_WOMEN,3 ,500,RESUME_SEARCH_PATH));
		criterias.add(createSearchCriteria("3",SearchType.EXEP_WOMEN,4 ,500,RESUME_SEARCH_PATH));
		criterias.add(createSearchCriteria("4",SearchType.EXEP_WOMEN,5 ,500,RESUME_SEARCH_PATH));
		criterias.add(createSearchCriteria("5",SearchType.EXEP_WOMEN,6 ,500,RESUME_SEARCH_PATH));
		criterias.add(createSearchCriteria("6",SearchType.EXEP_WOMEN,7 ,500,RESUME_SEARCH_PATH));
		criterias.add(createSearchCriteria("7",SearchType.EXEP_WOMEN,8 ,500,RESUME_SEARCH_PATH));
		criterias.add(createSearchCriteria("8",SearchType.EXEP_WOMEN,9 ,500,RESUME_SEARCH_PATH));
		criterias.add(createSearchCriteria("9",SearchType.EXEP_WOMEN,10 ,500,RESUME_SEARCH_PATH));
		criterias.add(createSearchCriteria("10",SearchType.EXEP_WOMEN,11 ,500,RESUME_SEARCH_PATH));
		
		criterias.add(createSearchCriteria("0",SearchType.EXEP,1 ,500,RESUME_SEARCH_PATH));
		criterias.add(createSearchCriteria("1",SearchType.EXEP,2 ,500,RESUME_SEARCH_PATH));
		criterias.add(createSearchCriteria("2",SearchType.EXEP,3 ,500,RESUME_SEARCH_PATH));
		criterias.add(createSearchCriteria("3",SearchType.EXEP,4 ,500,RESUME_SEARCH_PATH));
		criterias.add(createSearchCriteria("4",SearchType.EXEP,5 ,500,RESUME_SEARCH_PATH));
		criterias.add(createSearchCriteria("5",SearchType.EXEP,6 ,500,RESUME_SEARCH_PATH));
		criterias.add(createSearchCriteria("6",SearchType.EXEP,7 ,500,RESUME_SEARCH_PATH));
		criterias.add(createSearchCriteria("7",SearchType.EXEP,8 ,500,RESUME_SEARCH_PATH));
		criterias.add(createSearchCriteria("8",SearchType.EXEP,9 ,500,RESUME_SEARCH_PATH));
		criterias.add(createSearchCriteria("9",SearchType.EXEP,10 ,500,RESUME_SEARCH_PATH));
		criterias.add(createSearchCriteria("10",SearchType.EXEP,11 ,500,RESUME_SEARCH_PATH));*/
		
		criterias.add(createSearchCriteria("software tester",SearchType.KEYWORD,1 ,500,RESUME_SEARCH_PATH));
		criterias.add(createSearchCriteria("Network support",SearchType.KEYWORD,1 ,500,RESUME_SEARCH_PATH));
		criterias.add(createSearchCriteria("BPO",SearchType.KEYWORD,1 ,500,RESUME_SEARCH_PATH));
		criterias.add(createSearchCriteria("Customer support",SearchType.KEYWORD,1 ,500,RESUME_SEARCH_PATH));
		criterias.add(createSearchCriteria("Telemarketing",SearchType.KEYWORD,1 ,500,RESUME_SEARCH_PATH));
		criterias.add(createSearchCriteria("Hotel Management",SearchType.KEYWORD,1 ,500,RESUME_SEARCH_PATH));
		criterias.add(createSearchCriteria("KPO",SearchType.KEYWORD,1 ,500,RESUME_SEARCH_PATH));
		criterias.add(createSearchCriteria("Designer",SearchType.KEYWORD,1 ,500,RESUME_SEARCH_PATH));
		criterias.add(createSearchCriteria("MECHANICAL",SearchType.KEYWORD,1 ,500,RESUME_SEARCH_PATH));
		criterias.add(createSearchCriteria("Electrical",SearchType.KEYWORD,1 ,500,RESUME_SEARCH_PATH));
		criterias.add(createSearchCriteria("ELECTRONICS",SearchType.KEYWORD,1 ,500,RESUME_SEARCH_PATH));
		criterias.add(createSearchCriteria("Fashion",SearchType.KEYWORD,1 ,500,RESUME_SEARCH_PATH));
		criterias.add(createSearchCriteria("Civil",SearchType.KEYWORD,1 ,500,RESUME_SEARCH_PATH));
		criterias.add(createSearchCriteria("Doctor",SearchType.KEYWORD,1 ,500,RESUME_SEARCH_PATH));
		criterias.add(createSearchCriteria("Consultants",SearchType.KEYWORD,1 ,500,RESUME_SEARCH_PATH));
		criterias.add(createSearchCriteria("Quality",SearchType.KEYWORD,1 ,500,RESUME_SEARCH_PATH));
		criterias.add(createSearchCriteria("Transportation",SearchType.KEYWORD,1 ,500,RESUME_SEARCH_PATH));
		criterias.add(createSearchCriteria("Sales, Marketing, Banking",SearchType.KEYWORD,1 ,500,RESUME_SEARCH_PATH));
		
		criterias.add(createSearchCriteria("HR-0-4",SearchType.EXEP_KEYWORD,1 ,500,RESUME_SEARCH_PATH));
		criterias.add(createSearchCriteria("HR-5-15",SearchType.EXEP_KEYWORD,1 ,500,RESUME_SEARCH_PATH));
		criterias.add(createSearchCriteria("Manage-0-3",SearchType.EXEP_KEYWORD,1 ,500,RESUME_SEARCH_PATH));
		criterias.add(createSearchCriteria("Manage-4-6",SearchType.EXEP_KEYWORD,1 ,500,RESUME_SEARCH_PATH));
		criterias.add(createSearchCriteria("Manage-7-10",SearchType.EXEP_KEYWORD,1 ,500,RESUME_SEARCH_PATH));
		criterias.add(createSearchCriteria("Marketing-0-4",SearchType.EXEP_KEYWORD,1 ,500,RESUME_SEARCH_PATH));
		criterias.add(createSearchCriteria("Marketing-5-15",SearchType.EXEP_KEYWORD,1 ,500,RESUME_SEARCH_PATH));
	
		
		return criterias;
	}
	
	private SearchCriteria createSearchCriteria(String searchQuery,SearchType searchType,Integer priority ,Integer endPosition,String url){
		SearchCriteria searchCriteria = new SearchCriteria();
		searchCriteria.setCurrentPosition(0);
		searchCriteria.setEndPosition(endPosition);
		searchCriteria.setPriority(priority);
		searchCriteria.setSearchQuery(searchQuery);
		searchCriteria.setSearchStatus(SearchStatus.NOT_STARTED);
		searchCriteria.setStartPosition(0);
		searchCriteria.setUrl(url);
		searchCriteria.setSearchType(searchType);
		
		criteriaService.saveOrUpdate(searchCriteria);
		
		return searchCriteria;
		
	}

}
